var indexDAO = require('../models/indexDAO')
var formidable = require('formidable')
var path = require('path')
var jwt = require('jsonwebtoken')
var indexController = {
    getAlladdress: function (req, res) {
        indexDAO.getAlladdress(function (err, results) {
            if (err) {
                res.json({ code: 500, msg: '地址信息查询失败！' })
            } else {
                res.json({ code: 200, data: results, msg: '地址查询成功!' })
            }
        })
    },
    getspinonce: function (req, res) {
        var spin = { userId :req.body.userID,integralonce :req.body.integralonce,integralsource: req.body.integralsource}
        console.log(spin)
        indexDAO.getspinonce(spin,function (err, results) {
            console.log(results)
            if (err) {
                res.json({ code: 500, msg: '签到失败！' +err})
            } else {
                res.json({ code: 200, data: results, msg: '签到成功!' })
            }
        })
    },
    getAllmap: function (req, res) {
        indexDAO.getAllmap(function (err, results) {
            if (err) {
                console.log(err)
                res.json({ code: 500, msg: '经纬度查询失败！' })
            } else {
                res.json({ code: 200, data: results, msg: '经纬度查询成功!' })
            }
        })
    },
}
module.exports = indexController